package us.yunhe.server;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import us.yunhe.dao.IUserDao;
import us.yunhe.model.User;
import us.yunhe.util.SqlSessioinFactoryUtil;

public class UserServer {

	SqlSession session = SqlSessioinFactoryUtil.getSqlSession();
	IUserDao userDao = session.getMapper(IUserDao.class);
	
	public User login(String uname,String pwd){
		return userDao.login(uname, pwd);
	}
	
	public int register(String uname,String pwd){
		return userDao.register(uname, pwd);
	}
	
	public List<User> searchAll(int pageIndex,int pageSize){
		pageIndex = (pageIndex-1)*pageSize;
		return userDao.searchAll(pageIndex,pageSize);
	}
	
	public int getCount(){
		return userDao.getCount();
	}
}
